package com.rzj.sys_lab_assistant.service.impl;

import com.rzj.sys_lab_assistant.dao.AssistantJobMapper;
import com.rzj.sys_lab_assistant.entity.AssistantJob;
import com.rzj.sys_lab_assistant.service.IAssistantJobService;
import com.rzj.sys_lab_assistant.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * @program: sys_lab_assistant
 * @description:
 * @author: 作者
 * @create: 2021-07-02 22:02
 */
@Service
public class AssistantJobServiceImpl implements IAssistantJobService {

    @Autowired
    AssistantJobMapper assistantJobMapper;

    TimeUtils timeUtils;

    @Override
    public List<AssistantJob> assistantJobsList(int aId) {
        return assistantJobMapper.listAssistantJobs(aId);
    }

    @Override
    public AssistantJob getAssistantJobById(int jobId) {
        return assistantJobMapper.getAssistantJobById(jobId);
    }

    @Override
    public List<AssistantJob> getAssistantJobByDate(Date time, String account) {
        return assistantJobMapper.getAssistantJobByDate(time, account);
    }

    @Override
    public int saveAssistantJob(AssistantJob assistantJob) {
        assistantJob.setCreateTime(timeUtils.getTime());
        assistantJob.setModifyTime(timeUtils.getTime());
        return assistantJobMapper.saveAssistantJob(assistantJob);
    }

    @Override
    public int updateAssistantJob(AssistantJob assistantJob) {
        assistantJob.setModifyTime(timeUtils.getTime());
        return assistantJobMapper.updateAssistantJob(assistantJob);
    }

    @Override
    public int deleteAssistantJob(int jobId) {
        return assistantJobMapper.deleteAssistantJob(jobId);
    }
}
